- row_div_id = "error_log_row_#{error_log.error_hash}" 

%tr{:class => cycle('odd','even'), :id => row_div_id}
  %td 
    %div{:class => "level_box level_#{error_log.level}"}
      = error_log.level
    %span.time
      -# when using select, activerecord returns strings only
      = Time.parse(error_log.created_at_last).strftime('%Y-%m-%d %H:%M')
      %span{:style => 'color: #7a7'}
        (#{distance_of_time_in_words error_log.created_at_last,Time.now} ago) 
    %br 
    %br
    [#{error_log.category}]
    %b= error_log.error
    %br 
    %br

    -# Repeated N times
    - if error_log.count_all.to_i > 1
      %div{:style => "text-align: center; clear: both"}
        Repeated 
        %b
          %span{:style => "font-size: #{[12 + error_log.count_all.to_i,100].min}px;"}
            = error_log.count_all
        times.
        %br
        %span.time_first{:style => 'color: #aaa'}
          %i in the last #{distance_of_time_in_words error_log.created_at_first,Time.now}

    -# error params if logged     
    - if error_log.params && !error_log.params.empty? 
      %br
      example params:
      %pre
        = error_log.params.pretty_inspect 

    -# backtrace
    - bt = error_log.backtrace.split("\n") 
    %div.backtrace 
      = raw bt[0...3].join(" <br />") 
      - if bt.size > 4 
        - bid = "error_log_bt_#{error_log.id}" 
        = link_to_function '...', "$('#{bid}').show();" 
        %span{:style => "display: none", :id => bid}
          = raw bt[4...-1].join(" <br />")                  
    %span.actions
      - if viewing_archive? 
        = link_to('delete premamently', { :action => :delete, :error_hash => error_log.error_hash, :row_div_id => row_div_id }, :remote => true, :onclick => "this.innerHTML = 'wait for it...';")
      - else
        = link_to('mark as read', { :action => :set_viewed, :error_hash => error_log.error_hash, :row_div_id => row_div_id }, :remote => true, :onclick => "this.innerHTML = 'wait for it...';")
